import api from './base'

/**
 * 获取token
 * @returns
 */

export function getUserToken(data) {
  return api({
    url: '/oauth/noToken/getToken',
    method: 'post',
    data
    // otherConfigs: {
    //   showSignErrorMessage: false
    // }
  })
}
/**
 *
 * 核心登录
 * 获取核心页面session
 * @returns
 */

export function getCoreSession(params) {
  return api({
    url: '/oauth/coreLogin',
    method: 'GET',
    params
  })
}
/**
 *
 * 按钮权限
 * @returns
 */

export function getPermission() {
  return api({
    url: '/oauth/resource/getCockpitResourceByMenuPath',
    method: 'GET'
  })
}

/**
 * cc免密登录
 * @returns
 */

export function getNoTokenLogin(data) {
  return api({
    url: '/oauth/noToken/login',
    method: 'post',
    data,
    meta: {
      'X-isTenant': 'false',
      tenantView: '0000'
    },
    otherConfigs: {
      showSignErrorMessage: true
    }
  })
}
/**
 * cc免密登录-账户是否拥有访问权限
 * @returns
 */

export function checAuth(params) {
  return api({
    url: '/ci/cockpit/checkAuth',
    method: 'GET',
    params
  })
}

// 智能驾舱查询自然人对应的所有账号
export function queryUserNameList(data) {
   return api({
    url: `/ci/insured/authority/status/getUserNameList`,
    method: 'POST',
    data
  })
}

// 重置密码校验ihealth账号是否有效
export function checkAccount(ihealthAccount) {
   return api({
    url: `/ci/insured/authority/status/checkAccount/?iHealthAccount=${ihealthAccount}`,
    method: 'GET',
  })
}
// 重置密码

export function resetPassword(data) {
   return api({
    url: `/ci/insured/authority/status/resetPassword`,
    method: 'POST',
    data
  })
}